package com.hqd.ch03.v25.spel.express;

import com.hqd.ch03.v25.factory.ConfigurableBeanFactory;

/**
 * 提供BeanFactory上下文，用以获取Bean对象
 */
public class BeanExpressionContext {
    private final ConfigurableBeanFactory beanFactory;

    public BeanExpressionContext(ConfigurableBeanFactory beanFactory) {
        this.beanFactory = beanFactory;
    }

    public boolean containsObject(String key) {
        return this.beanFactory.containsBean(key);
    }

    public Object getObject(String key) {
        return beanFactory.getBean(key);
    }

    public ConfigurableBeanFactory getBeanFactory() {
        return beanFactory;
    }
}
